import axios from "./axios";
// e5f907b4ba1f08c8503433a5da97f0c9

// 获取User所有数据
export const getUserAll = () => axios.get("http://localhost/user");

// 获取User分页数据
export const getUserPage = (current) =>
  axios.get(`http://localhost/page/${current}`);

// User新增成员
export const addUser = (user) => axios.post("http://localhost/add", user);

// User修改成员
export const updateUser = (user) => axios.post("http://localhost/update", user);

// User删除成员
export const deleteUser = (id) => axios.post(`http://localhost/delete/${id}`);

// User条件查询
export const selectUserName = (name) =>
  axios.get(`http://localhost/selectName/${name}`);

// ----------------------------------------------------------------------------

// 获取Goods所有数据
export const getGoodsAll = () => axios.get("http://localhost/goods");

// 获取Goods分页数据
export const getGoodsPage = (current) =>
  axios.get(`http://localhost/goods/${current}`);

// Goods上架商品
export const addGoods = (goods) =>
  axios.post(`http://localhost/addGoods`, goods);

// Goods修改库存
export const modifyinventory = (goods) =>
  axios.post(`http://localhost/modifyinventory`, goods);

// Goods下架商品
export const deleteGoods = (id) =>
  axios.post(`http://localhost/deleteGoods/${id}`);

// Goods条件查询
export const selectGoodsName = (name) =>
  axios.get(`http://localhost/selectNameGoods/${name}`);

//-----------------------------------------------------------------------------

// 获取user2分页数据
export const getUserPage2 = (current) =>
  axios.get(`http://localhost/page2/${current}`);

// User2删除成员
export const deleteUser2 = (id) => axios.post(`http://localhost/delete2/${id}`);

// ----------------------------------------------------------------------------

// 获取user2分页数据
export const getOrderPage = (current) =>
  axios.get(`http://localhost/order/${current}`);

// ----------------------------------------------------------------------------

// 校验用户账号密码
export const selectLogin = () => axios.get(`http://localhost/login`);

// 获取北京时间
export const getTime = () =>
  axios.get("api.php?api=2&key=e5f907b4ba1f08c8503433a5da97f0c9");

// 获取天气
export const getWeather = () =>
  axios.get("api.php?api=11&key=e5f907b4ba1f08c8503433a5da97f0c9&city=西安");

// 翻译2
export const translate = (text) =>
  axios.get("api.php?api=55&key=e5f907b4ba1f08c8503433a5da97f0c9&text=" + text);

// 抖音热搜
export const getHotSearch = () =>
  axios.get("api.php?api=29&key=e5f907b4ba1f08c8503433a5da97f0c9&web=dy");
